package com.reg;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017-05-18.
 */
public class CharSequenceRegular implements IRegular {

    String sequence_chars;

    CharSequenceRegular(String sequence){
        sequence_chars = sequence;
    }

    @Override
    public List<String> match(char[] chars) {
        int i = 0;
        for(; i < sequence_chars.length() && i < chars.length; i++){
            if(chars[i] !=sequence_chars.charAt(i))break;
        }
        if(i==sequence_chars.length())
        {
            ArrayList<String> re = new ArrayList<String>();
            re.add(new String(sequence_chars));
            return re;
        }else {
            return null;
        }
    }
}
